import request from '/@/utils/request'
import {prefix} from '/@/api/project/index'

/**
 * 获取项目分组列表, 级联组员
 */
export function getProjectGroups(projectId: string) {
  return request({
    url: prefix + '/group/getList?projectId=' + projectId,
    method: 'get'
  })
}

/**
 * 添加组成员
 */
export function addGroupMembers(data: any) {
  return request({
    url: prefix + '/group/addMembers',
    method: 'post',
    data
  })
}

export function editMember(data: any) {
  return request({
    url: prefix + '/member/editMember',
    method: 'post',
    data
  })
}

/**
 * 从组里移除该组员, 如果此用户没有在任何组就移出项目
 */
export function removeMember(data: any) {
  return request({
    url: prefix + '/member/removeMember',
    method: 'post',
    data
  })
}

/**
 * 获取游离在分组之外的成员列表
 */
export function nomadicMembers(projectId: string) {
  return request({
    url: prefix + '/member/getNomadicMembers?projectId=' + projectId,
    method: 'get'
  })
}
